<!-- 批次库存查询 - 综合表单页面 -->
<template>
  <div class="page-container">
    <ex_super_table_page v-bind="option" ref="SuperTablePage">

    </ex_super_table_page>

  </div>
</template>
<script>
import SuperTablePageFunction from '@/mixin/super-table-page-function';


export default {
  title: 'title_stock_log_query',
  mixins: [SuperTablePageFunction],
  components: {},
  data() {
    return {

      option: {
        search: {
          model: [
            {label: "label_customer", key: "customerId", type: 'common_customer_choose',},
            {label: "label_sku", key: "skuId", type: 'sku_selec_input',},
            {label: "label_business_type", key: "bizType", type: 'select', enum: 'BizTypeEnum'},

            {label: "label_warehouse_location ", key: "locationCodes", type: 'input',},

            {
              label: "label_stock_change_type",
              key: "changeType",
              type: 'select',
              enum: 'StockChangeTypeEnum',
              attrs: {clearable: true},
            },

            {
              label: "label_change_time", key: "time1", type: 'date-picker', //日期选择
              attrs: {type: "datetime"}
            },
            {
              label: "", key: "time2", type: 'date-picker', //日期选择
              attrs: {type: "datetime"}
            },
          ],
        },

        table: {
          url: "/wms-api/stock/StockQueryRpc/stockBatchLogQuery.json",
          attrs: {},
          model: [
            {
              key: 'customerCode', label: 'label_srm_api_request_customer_code',
              attrs: {
                formatter: (r, c, v, i) => r.customerCode + (r.customerName ? (" - " + r.customerName) : "")
              }
            },

            {
              key: 'skuOnlyCode', label: 'label_sku_code',
              attrs: {
                formatter: (r, c, v, i) => r.skuId < 0 ? "——" : v
              }
            },
            {
              key: 'skuName', label: 'label_sku_name',
              attrs: {
                formatter: (r, c, v, i) => r.skuId < 0 ? "——" : v
              }
            },

            {
              key: 'batchNo', label: 'label_batch_code',
            },
            {
              key: 'refType', label: 'label_related_order',
              attrs: {
                formatter: (r, c, v, i) => {
                  return this.$enumShow(v, 'OrderTypeEnum') + ' ' + r.refCode
                }
              }
            },
            // {
            //   key: 'refCode', label: '关联单据号',
            // },
            {
              key: 'changeType', label: 'label_change_type',
              attrs: {
                formatter: (r, c, v, i) => {
                  return this.$enumShow(v, 'StockChangeTypeEnum')
                }
              }
            },
            {
              key: 'bizType', label: 'label_business_type', 'width': 120, 'show-overflow-tooltip': true,
              formatter: (r, c, v, i) => this.$enumShow(v, "BizTypeEnum")
            },
            {
              key: 'locationCode', label: 'label_warehouse_location_code',
            },
            {
              key: 'containerCode', label: 'label_container_code',
            },


            {
              key: 'gmtModify', label: 'label_change_time',
              attrs: {
                formatter: (r, c, v, i) => {
                  return this.$dateFormat(v)
                }
              }
            }, {
              key: 'freezeQty', label: 'label_frozen_count',
              attrs: {
                formatter: (r, c, v, i) => this.formatQty(v, r.modifyFreezeQty)
              }
            },
            {
              key: 'lockQty', label: 'label_lock_count',
              attrs: {
                formatter: (r, c, v, i) => this.formatQty(v, r.modifyLockQty)
              }
            },
            {
              key: 'usableQty', label: 'label_usable_count',
              attrs: {
                formatter: (r, c, v, i) => this.formatQty(v, r.modifyUsableQty)
              }
            },
            {
              key: 'totalQty', label: 'label_sum',
              attrs: {
                formatter: (r, c, v, i) => this.formatQty(v, r.modifyFreezeQty + r.modifyLockQty + r.modifyUsableQty)
              }
            },
            {key:'operateUserName',label:'label_operate_user'}
          ],

        }
        ,

      },


    };
  },
  methods: {
    formatQty(qty, modifyQty) {
      if (modifyQty > 0) {
        return qty + "(+" + modifyQty + ")"
      } else if (modifyQty < 0) {
        return qty + "(" + modifyQty + ")"
      }
      return qty
    }
  }
};

</script>
<style></style>
